package com.yvon.service.demo.netty.nio.socket;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * @author : Yvon
 * @since : 2022-06-20
 */
public class ChannelDemo7 {

    public static void main(String[] args) {

    }

    static class BossEventLoop implements Runnable {
        private Selector boss;

        @Override
        public void run() {

        }

    }

    @Slf4j
    static class WorkerEventLoop implements Runnable {
        private Selector worker;
        private volatile boolean start = false;
        private int index;

        private final ConcurrentLinkedQueue<Runnable> tasks = new ConcurrentLinkedQueue<>();

        public WorkerEventLoop(int index) {
            this.index = index;
        }

        public void register(SocketChannel sc) throws IOException {
            if (!start) {
                worker = Selector.open();
            }
        }

        @Override
        public void run() {

        }
    }
}
